/*
    Side Navigation
    author: zhao xin
    date: 2017.4
*/


! function($) {
    'use strict';

    $.fn.sideNav = function() {
        this.each(function(index, el) {
            $(el).on('click', '.nav-head', function(event) {
            	var $navhead = $(this);
            	var $subnav = $navhead.siblings('.sub-nav');

            	if ($navhead.hasClass('active')) {
            		$subnav.removeClass('active');
            		$navhead.removeClass('active');
            	} else {
            		$subnav.addClass('active');
            		$navhead.addClass('active');
            	}

            	return false;
            });
        });
    }

    $(document).ready(function() {
        $('.side-nav').sideNav();
    });
}(jQuery);